1. Field of the Invention
The present invention relates to a tone generation apparatus for, e.g., an electronic keyboard instrument.
2. Description of the Related Art
In electronic keyboard instruments such as an electronic piano, an electronic organ, and the like, tone source information stored in a PCM waveform memory is read out according to a tone color and key information, and is output as a tone generation signal after its amplitude, envelope, and the like are processed. In order to generate tones corresponding to some simultaneously depressed keys or to generate accompaniment tones, a tone generator has a plurality of simultaneous tone channels.
A channel assignor manages tone channels, and assigns a tone to be generated in response to a key-ON event to an empty channel or a channel having a low priority order.
As a key assign method of the assignor, a first-depression priority method or a last-depression priority method is known. Also, the following method is known. In this method, when there is no empty channel, the envelopes of assigned tone waveforms are compared, and a new key is assigned to a tone channel generating the lowest envelope level, i.e., a channel closer to the end of tone generation (envelope minimum value detection method).
An electronic keyboard instrument, which can select the following sole (monophonic) play mode, is known. In the sole-play mode, only one channel (or two channels) is assigned as a tone generation channel corresponding to a keyboard operation, and other tone channels are assigned to auto-accompaniment tones, and the like. In this sole-play mode, channel assignment processing called a key recovery method is often applied for.
In the key recovery method, tone generation is performed in a monophonic last-depression priority mode, and a key depressed last is assigned to a single tone channel. When a plurality of keys are depressed, tones are sequentially generated in the last-depression priority manner, and at the same time, the key ON order is stored in a table. When a currently tone-ON key is released, if there is another key in key ON state, the last key in the last-depression order in the depression order storage table is assigned to the tone channel to generate a corresponding tone (key recovery processing).
The above-mentioned key recovery processing in the sole-play mode requires complicated processing steps, and also requires a stack area of a memory for storing the key ON order.
FIG. 6 shows an assignor (channel assignment) processing sequence based on the conventional key recovery method, and FIGS. 7A to 7C are views for explaining stack processing of a memory for storing the key ON order.
In step 71, it is checked if a play mode is a poly (polyphonic) play mode or a sole (monophonic) play mode. In the poly-play mode, poly processing is performed in step 72. In the sole-play mode, an ON/OFF event of a key is discriminated in step 73. If an ON event is detected, a tone channel is searched and assigned in step 74, and the key ON order is stored in a stack as key recovery information in step 75. FIG. 7A shows the content of a stack 19a at this time. When key ON events occur in the order of C, B, and A, note codes (key codes) A, B, and C are stored in the order of A, B, and C from the lower end of the stack area 19a. When a key D is newly depressed at that time, a tone corresponding to a note D is generated, and a note code D is stored in the lower end of the stack area 19a (push).
If a key OFF event is detected in step 73, it is checked in step 76 if a key corresponding to the detected OFF event is the same as the key assigned to a currently tone-ON channel. If YES in step 76, OFF information of the key is generated (assign OFF) in step 77. In step 78, the stack area is rewritten (pull), and in step 79, the stacked last key information is assigned to a tone channel (key recovery processing). For example, when note codes C, B, and A are stacked in this order in the stack area, as shown in FIG. 7B, if the key A is released, the note code A is pushed out from the stack area upon tone-OFF processing of the key A, and the note code B is assigned to the tone channel.
If it is determined in step 76 that the OFF key is different from the currently tone-ON channel content, only rewrite processing of key recovery information is performed in step 80. For example, when node codes C, B, and A are stacked in this order, as shown in FIG. 7C, if the key B is released, the note code B is deleted from the stack area, and the key ON order is rewritten to C and A. Tone generation corresponding to the key A is continued.
As described above, the contentional key recovery processing in the sole-play mode requires many program steps, and consumes the stack area for storing the key ON order. Since the CPU of the electronic musical instrument executes real-time processing, an expensive, high-speed microprocessor is required.
When the stack area is saved, the number of pieces of key recovery information to be held is limited. When a large number of keys are simultaneously depressed, it is difficult to perform key recovery processing.